<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" th:replace="~{admin/_inc/_layout::layout(~{::title},~{::link},~{::page_script})}">
<head>
<title>[[#{page.admin_sys_option} +'|'+#{applicationDisplayName}]]</title>
<!-- bootstrap -->
<link rel="stylesheet" type="text/css" th:href="@{/webjars/bootstrap/3.3.6/css/bootstrap.min.css}">
<!-- datatables -->
<link rel="stylesheet" type="text/css" th:href="@{/webjars/datatables/1.10.20/css/dataTables.bootstrap.css}">
<link rel="stylesheet" type="text/css" th:href="@{/webjars/datatables/1.10.20/css/jquery.dataTables.min.css}">
<link rel="stylesheet" type="text/css" th:href="@{/webjars/framework-ext/1.0.0/datatables/css/dataTables.css}">
<!-- font-awesome -->
<link rel="stylesheet" type="text/css" th:href="@{/webjars/font-awesome/4.7.0/css/font-awesome.min.css}">
<!-- lhgdialog -->
<link rel="stylesheet" type="text/css" th:href="@{/webjars/lhgdialog/4.2.0/skins/bootstrap2.css}">
<link rel="stylesheet" type="text/css" th:href="@{/webjars/framework-ext/1.0.0/datatables/css/dataTables.css}">
</head>
<body>
	<section th:fragment="content">
		<div class="row">
			<div class="col-md-2">
				<div class="box">
					<div class="box-header">
						<div class="box-header">
							<h3 class="box-title">系统缓存信息</h3>
						</div>
					</div>
					<div class="box-body no-padding">
						<span th:each="item : ${cacheInfo}"> <label th:text="${item.name}"></label> - ( <label th:text="${item.size}"></label> ) <br>
						</span>
					</div>
				</div>
			</div>
			<div class="col-md-10">
				<div class="box">
					<div class="box-header">
						<div class="box-header">
							<i class="fa fa-th"></i>
							<h3 class="box-title">系统配置信息</h3>
							<div class="box-tools pull-right">
								<a class='btn bg-blue btn-flat' th:href="@{/admin/sys_option/clearcache}" target="_blank">清空缓存</a>
							</div>
						</div>
					</div>
					<div class="box-body no-padding">
						<table id="tt" class="table table-bordered" style="width: 100%; white-space: nowrap">
							<tr>
								<th style="width: 20%">标题</th>
								<th style="width: 70%">值</th>
								<th style="width: 10%">操作</th>
							</tr>
							<tr th:each="_item : ${options}">
								<th th:text="${_item.option_tilte}">tilte</th>
								<td><input style="width: 100%" th:id="${_item.option_name}" th:value="${_item.option_value}"><br> <em style="color: #FF3030" th:text="${_item.option_desc}"></em></td>
								<td>
									<button class='btn bg-blue btn-sm' th:data-href="@{/admin/sys_option/save_option}" value="保存" type="button">保存</button>
								</td>
							</tr>
						</table>
					</div>
				</div>
			</div>
		</div>
	</section>
</body>
<script type="text/javascript" charset="UTF-8" th:src="@{/webjars/jquery/1.11.1/jquery.min.js}"></script>
<!-- datatables -->
<script type="text/javascript" charset="UTF-8" th:src="@{/webjars/bootstrap/3.3.6/js/bootstrap.min.js}"></script>
<!-- jquery-framework-ext -->
<script type="text/javascript" charset="UTF-8" th:src="@{/webjars/framework-ext/1.0.0/jquery/js/jquery-framework-ext.js}"></script>
<th:block th:fragment="page_script">
<script type="text/javascript" charset="UTF-8" th:src="@{/webjars/jquery-validation/1.19.0/jquery.validate.min.js}"></script>
<script type="text/javascript" charset="UTF-8" th:src="@{/webjars/jquery-validation/1.19.0/additional-methods.min.js}"></script>
<script type="text/javascript" charset="UTF-8" th:src="@{/webjars/jquery-validation/1.19.0/localization/messages_zh.min.js}"></script>

<script type="text/javascript" charset="UTF-8" th:src="@{/webjars/datatables/1.10.20/js/jquery.dataTables.min.js}"></script>
<script type="text/javascript" charset="UTF-8" th:src="@{/webjars/datatables/1.10.20/js/dataTables.bootstrap.min.js}"></script>

<script type="text/javascript" th:inline="javascript">
	var obj = {
		init : function() {
			$('#tt tbody').on('click', '.bg-blue', function(e) {
				$(e.target).prop("disabled", true);
				var val = $(e.target).parents('tr').find('input').val();
				var id = $(e.target).parents('tr').find('input').attr('id');
				$.ajax({
					type : "POST",
					url : $(e.target).data('href'),
					data : {
						option_name : id,
						option_value : val
					},
					complete : function() {
						$(e.target).prop("disabled", false);
					},
					success : function(data) {
						window.location.reload(true);
					},
					error : ajaxerror
				});
			});
		}
	}
	$(function() {
		obj.init();
	})
</script>
</th:block>
</html>
